/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

/dts-v1/;

#include "omap36xx.dtsi"
#include "logicpd-torpedo-som.dtsi"
#include "omap-gpmc-smsc9221.dtsi"

/ {
	model = "LogicPD Zoom DM3730 Torpedo Development Kit";
	compatible = "logicpd,dm3730-torpedo-devkit", "ti,omap36xx";

	gpio_keys {
		compatible = "gpio-keys";
		pinctrl-names = "default";
		pinctrl-0 = <&gpio_key_pins &gpio_key_pins_wkup>;

		sysboot2 {
			label = "sysboot2";
			gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;	/* gpio2 */
			linux,code = <BTN_0>;
			gpio-key,wakeup;
		};

		sysboot5 {
			label = "sysboot5";
			gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;	/* gpio7 */
			linux,code = <BTN_1>;
			gpio-key,wakeup;
		};

		gpio1 {
			label = "gpio1";
			gpios = <&gpio6 21 GPIO_ACTIVE_LOW>;	/* gpio181 */
			linux,code = <BTN_2>;
			gpio-key,wakeup;
		};

		gpio2 {
			label = "gpio2";
			gpios = <&gpio6 18 GPIO_ACTIVE_LOW>;	/* gpio178 */
			linux,code = <BTN_3>;
			gpio-key,wakeup;
		};
	};

	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&led_pins>;

		led1 {
			label = "led1";
			gpios = <&gpio6 20 GPIO_ACTIVE_HIGH>;	/* gpio180 */
			linux,default-trigger = "cpu0";
		};

		led2 {
			label = "led2";
			gpios = <&gpio6 19 GPIO_ACTIVE_HIGH>;	/* gpio179 */
			linux,default-trigger = "none";
		};
	};
};

&charger {
	ti,bb-uvolt = <3200000>;
	ti,bb-uamp = <150>;
};

&gpmc {
	ranges = <1 0 0x08000000 0x1000000>;	/* CS1: 16MB for LAN9221 */

	ethernet@gpmc {
		pinctrl-names = "default";
		pinctrl-0 = <&lan9221_pins>;
		interrupt-parent = <&gpio5>;
		interrupts = <1 IRQ_TYPE_LEVEL_LOW>;		/* gpio129 */
		reg = <1 0 0xff>;
	};
};

&mmc1 {
	interrupts-extended = <&intc 83 &omap3_pmx_core 0x11a>;
	pinctrl-names = "default";
	pinctrl-0 = <&mmc1_pins &mmc1_cd>;
	cd-gpios = <&gpio4 31 IRQ_TYPE_LEVEL_LOW>;		/* gpio127 */
	vmmc-supply = <&vmmc1>;
	bus-width = <4>;
	cap-power-off-card;
};

&omap3_pmx_core {
	gpio_key_pins: pinmux_gpio_key_pins {
		pinctrl-single,pins = <
			OMAP3_CORE1_IOPAD(0x21d6, PIN_INPUT_PULLUP | MUX_MODE4)	/* mcspi2_clk.gpio_178 */
			OMAP3_CORE1_IOPAD(0x21dc, PIN_INPUT_PULLUP | MUX_MODE4)	/* mcspi2_cs0.gpio_181 */
		>;
	};

	led_pins: pinmux_led_pins {
		pinctrl-single,pins = <
			OMAP3_CORE1_IOPAD(0x21d8, PIN_OUTPUT | MUX_MODE4)	/* gpio_179 */
			OMAP3_CORE1_IOPAD(0x21da, PIN_OUTPUT | MUX_MODE4)	/* gpio_180 */
		>;
	};

	mmc1_pins: pinmux_mmc1_pins {
		pinctrl-single,pins = <
			OMAP3_CORE1_IOPAD(0x2144, PIN_OUTPUT | MUX_MODE0)	/* sdmmc1_clk.sdmmc1_clk */
			OMAP3_CORE1_IOPAD(0x2146, PIN_INPUT | MUX_MODE0)	/* sdmmc1_cmd.sdmmc1_cmd */
			OMAP3_CORE1_IOPAD(0x2148, PIN_INPUT | MUX_MODE0)	/* sdmmc1_dat0.sdmmc1_dat0 */
			OMAP3_CORE1_IOPAD(0x214a, PIN_INPUT | MUX_MODE0)	/* sdmmc1_dat1.sdmmc1_dat1 */
			OMAP3_CORE1_IOPAD(0x214c, PIN_INPUT | MUX_MODE0)	/* sdmmc1_dat2.sdmmc1_dat2 */
			OMAP3_CORE1_IOPAD(0x214e, PIN_INPUT | MUX_MODE0)	/* sdmmc1_dat3.sdmmc1_dat3 */
		>;
	};
};

&omap3_pmx_wkup {
	gpio_key_pins_wkup: pinmux_gpio_key_pins_wkup {
		pinctrl-single,pins = <
			OMAP3_WKUP_IOPAD(0x2a0a, PIN_INPUT_PULLUP | MUX_MODE4)	/* sys_boot0.gpio_2 */
			OMAP3_WKUP_IOPAD(0x2a14, PIN_INPUT_PULLUP | MUX_MODE4)	/* sys_boot5.gpio_7 */
		>;
	};

	lan9221_pins: pinmux_lan9221_pins {
		pinctrl-single,pins = <
			OMAP3_WKUP_IOPAD(0x2a5a, PIN_INPUT | MUX_MODE4)		/* reserved.gpio_129 */
		>;
	};

	mmc1_cd: pinmux_mmc1_cd {
		pinctrl-single,pins = <
			OMAP3_WKUP_IOPAD(0x2a54, PIN_INPUT_PULLUP | MUX_MODE4)	/* reserved.gpio_127 */
		>;
	};
};

&uart1 {
	interrupts-extended = <&intc 72 &omap3_pmx_core OMAP3_UART1_RX>;
};

/* Wired to the tps65950 on the SOM, only the USB connector is on the devkit */
&usb_otg_hs {
	interface-type = <0>;
	usb-phy = <&usb2_phy>;
	phys = <&usb2_phy>;
	phy-names = "usb2-phy";
	mode = <3>;
	power = <50>;
};
